load("@rules_cc//cc:defs.bzl", "cc_library")

package(default_visibility = ["//visibility:private"])

cc_library(
    name = "lz4",
    visibility = ["//visibility:public"],
    deps = [
        ":lz4_core",
        ":lz4_frame",
        ":lz4_hc",
        ":lz4_file",
    ],
)

cc_library(
    name = "lz4_core",
    srcs = ["lib/lz4.c"],
    hdrs = ["lib/lz4.h"],
    strip_include_prefix = "lib",
)

cc_library(
    name = "lz4_hc",
    srcs = ["lib/lz4hc.c"],
    hdrs = ["lib/lz4hc.h"],
    strip_include_prefix = "lib",
    deps = [
        ":lz4_core",
        ":lz4_internal",
    ],
)

cc_library(
    name = "lz4_file",
    srcs = ["lib/lz4file.c"],
    hdrs = ["lib/lz4file.h"],
    strip_include_prefix = "lib",
    deps = [":lz4_frame"],
)

cc_library(
    name = "lz4_frame",
    srcs = ["lib/lz4frame.c"],
    hdrs = [
        "lib/lz4frame.h",
        "lib/lz4frame_static.h",
    ],
    strip_include_prefix = "lib",
    deps = [
        ":lz4_hc",
        ":xxhash",
    ],
)

cc_library(
    name = "lz4_internal",
    hdrs = ["lib/lz4.c"],
    strip_include_prefix = "lib",
)

cc_library(
    name = "xxhash",
    srcs = ["lib/xxhash.c"],
    hdrs = ["lib/xxhash.h"],
    defines = ["XXH_NAMESPACE=LZ4_"],
    strip_include_prefix = "lib",
)
